<template>
  <div class="a-son">
    子组件2
    <p>{{ age }}</p>
    <input v-model="count" type="text" />
    <button @click="changeAge">✅</button>
  </div>
</template>
<script>
export default {
  components: {},
  props: {
    age: {
      type: Number,
    },
  },
  data() {
    return {
      count: "",
    };
  },
  computed: {},
  created() {},
  mounted() {},
  methods: {
    changeAge() {
      // 1. $emit 触发事件，给父组件发送消息通知
      this.$emit("subAge", this.age + +this.count);
    },
  },
  watch: {},
};
</script>
<style scoped lang='less'>
.a-son {
  padding: 10px;
}
</style>
